package com.supms.course.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.supms.course.domain.CourseTarget;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.supms.course.domain.PaperReview;
import com.supms.course.service.IPaperReviewService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 论文(毕设)复查Controller
 * 
 * @author LiangHao
 * @date 2022-03-12
 */
@RestController
@RequestMapping("/paperReview")
public class PaperReviewController extends BaseController
{
    @Autowired
    private IPaperReviewService paperReviewService;

    /**
     * 查询论文(毕设)复查列表
     */
    @RequiresPermissions("course:paperReview:list")
    @GetMapping("/list")
    public TableDataInfo list(PaperReview paperReview)
    {
        startPage();
        List<PaperReview> list = paperReviewService.selectPaperReviewList(paperReview);
        return getDataTable(list);
    }

    /**
     * 导出论文(毕设)复查列表
     */
    @RequiresPermissions("course:paperReview:export")
    @Log(title = "论文(毕设)复查", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PaperReview paperReview)
    {
        List<PaperReview> list = paperReviewService.selectPaperReviewList(paperReview);
        ExcelUtil<PaperReview> util = new ExcelUtil<PaperReview>(PaperReview.class);
        util.exportExcel(response, list, "论文(毕设)复查数据");
    }

    /**
     * 获取论文(毕设)复查详细信息
     */
    @RequiresPermissions("course:paperReview:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(paperReviewService.selectPaperReviewById(id));
    }

    /**
     * 新增论文(毕设)复查
     */
    @RequiresPermissions("course:paperReview:add")
    @Log(title = "论文(毕设)复查", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PaperReview paperReview)
    {
        return toAjax(paperReviewService.insertPaperReview(paperReview));
    }

    /**
     * 修改论文(毕设)复查
     */
    @RequiresPermissions("course:paperReview:edit")
    @Log(title = "论文(毕设)复查", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PaperReview paperReview)
    {
        return toAjax(paperReviewService.updatePaperReview(paperReview));
    }

    /**
     * 删除论文(毕设)复查
     */
    @RequiresPermissions("course:paperReview:remove")
    @Log(title = "论文(毕设)复查", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(paperReviewService.deletePaperReviewByIds(ids));
    }

    /**
     * 获取本科毕业论文(设计)复查记录表（数据综合查看表）
     */
    @GetMapping("/getPaperReviewTable")
    public PaperReview getPaperReviewTable(PaperReview paperReview)
    {
        return paperReviewService.getPaperReviewTable(paperReview);
    }
}
